import sys 
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QVBoxLayout
from PyQt5.QtCore import pyqtSlot

def init_widget(w: QWidget):
    w.setWindowTitle("布局嵌套")
    w.resize(640, 480)
    
    layout = QHBoxLayout()
    w.setLayout(layout)
    
    layout.addWidget(QPushButton("1"))
    
    layout_col2 = QVBoxLayout()
    layout_col2.addWidget(QPushButton("2"))
    layout_col2.addWidget(QPushButton("3"))
    layout.addLayout(layout_col2)
    
    
    layout_col3 = QVBoxLayout()
    layout_col3.addWidget(QPushButton("4"))
    layout_col3.addWidget(QPushButton("5"))
    layout_col3.addWidget(QPushButton("6"))
    layout.addLayout(layout_col3)
    
    layout_col4 = QVBoxLayout()
    layout_col4.addWidget(QPushButton("7"))
    layout_col4.addWidget(QPushButton("8"))
    layout_col4.addWidget(QPushButton("9"))
    layout_col4.addWidget(QPushButton("10"))
    layout.addLayout(layout_col4)
    
if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = QWidget()
    init_widget(w)
    w.show()
    sys.exit(app.exec_())
    
    